<template>
	<view>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">图表示例</block>
		</cu-custom>
		<!-- 饼状图 -->
		<!-- <view <view class="cu-bar bg-white solid-bottom margin-top pie_chart">
			<pie-chart ref="pieChart0" :dataAs="pieData" canvasId="index_pie_1" />
			<view style="text-align: center;line-height: 40px;">饼状图PieChart</view>
			<button @click="changePieData">改变饼状图数据</button>
		</view> -->
		<view style="margin-bottom: 10px;">
			<view class="cu-form-group ">
				<view class="title">姓名</view>
				<view class="title">当前德育分</view>
			</view>			
		</view>
		<view v-for="(item,index) in datalist" :key="index">
			<view class="cu-form-group ">
				<view class="title">{{item.name}}</view>
				<view class="title">{{item.currentMoraleduPoint}}</view>
			</view>
		</view>
	</view>
</template>

<script>
import HistogramChart from '@/subPages/stan-ucharts/HistogramChart.vue';
import ArcbarChart from '@/subPages/stan-ucharts/ArcbarChart.vue';
import LineChart from '@/subPages/stan-ucharts/LineChart.vue';
import PieChart from '@/subPages/stan-ucharts/PieChart.vue';
import RingChart from '@/subPages/stan-ucharts/RingChart.vue';
export default {
	name: 'Index',
	components: {
		HistogramChart,
		ArcbarChart,
		LineChart,
		PieChart,
		RingChart
	},
	data() {
		return {
			studentMoreduMain: {
				institute: '', // 学院
				grade: '', // 哪届
				classe: '' // 班级
			},
			datalist:[] // 名单
		};
	},
	onShow(){
		this.getServerData()
	},
	methods: {
		getData () {
			var __this = this
			this.$set(this.studentMoreduMain, 'institute', this.studentMoreduMain.institute) // 学院
			this.$set(this.studentMoreduMain, 'classe', this.studentMoreduMain.classe) // 年级
			this.$http.post('/graph/Graph/getStudentsFromOffice',__this.studentMoreduMain).then(({data}) => {
				console.log(data.list)
				this.datalist = data.list
			})
		},
		getServerData () {
			var __this = this
			this.$http.get('/sys/user/info').then(({data}) => {
				if (data && data.success) {
					this.studentMoreduMain.classe = data.user.classn
					this.studentMoreduMain.institute = data.user.office.name
					this.studentMoreduMain.grade = data.user.grade
					__this.getData()
				}
			})
		}
	}
	// created() {
	// 	this.$nextTick(() => {
	// 		this.$refs['pieChart0'].showCharts();
	// 	});
	// 	//ajax调用
	// 	this.getServerData();
	// }
};
</script>

<style scoped>
.arcbar {
	display: flex;
}
</style>
